/**   
 * api接口统一管理
 */
 import axios from 'axios';

 let base = 'http://172.23.241.44:8080';
// /**
//  * 封装接口，示例
//  * @param {p是我们请求接口时携带的参数对象} p 
//  */
// export const apiAddress = p => post('api/helloworld',p);
// //调用商品列表,p为typeid(服装为1，食品为2)
export const apiGoodsList = params => {return axios.get(`${base}/admin/goods/list` ,{ params : params });};

// //查看添加商品列表,Get类型,p为typeid
// export const apiSelectAddList = p => get('api/admin/goods/add',p);
// //上新,Post类型,p为typeid
export const apiAddsList = p => { return axios.post(`${base}/admin/goods/add`,p).then(res => res.data);};

// //查看进货,p为商品id：gid
// export const apiSelectStockList = p => get('api/admin/goods/stock',p);
// //进货，p为gid和count
export const apiStockList = p =>  { return axios.post(`${base}/admin/goods/stock`,p).then(res => res.data);};

// //查看销售记录,p为period和para
export const apiSaleListPage = params =>  {return axios.get(`${base}/admin/sale/period/list` ,{ params : params });};
// //销售情况输出excel，p为period和para
// export const apiSaleExport = p => get('api/admin/sale/period/export',p);

// //销售页面?p为gid
// export const apiBuyPage = p => get('api/admin/sale/simulateBuy',p);
// //Buy,p为gid和count
export const apiBuy = p => { return axios.post(`${base}/admin/sale/simulateBuy`,p).then(res => res.data);};

// //销售记录,p为空,此处语法不正确的话希望董小姐可以帮我改一下
// export const apiRecord = p => get('api/admin/sale/simulateBuy',p);

// //这个或许是后端之前调搜索页面的接口？p为typeid
// export const apiSearchPage = p => get('api/admin/search/typeid',p);
// //查找,p:typeid(必须),gname,brand,color,size,crowd,deadline,provenance,starttime,endtime
// export const apiSearch = p => post('api/admin/search/typeid',p);


export const apiUndercarriage = p => { return axios.post(`${base}/admin/undercarriage/goods/gid`,p).then(res => res.data);};
// //下架列表
// export const apiUndercarriageList = p => get('api/admin/undercarriage/list',p);
// //商品下架记录，p:gid
// export const apiUndercarriageRecovery = p => get('api/admin/undercarriage/recovery/goods',p);
// //后端暂时这么多接口，前端如果需要其他功能可以先自己写一下前端接口测试，后端等对接的时候再加
